import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hygf/bean/CustomerList.dart';
import 'package:hygf/bean/customer_detail.dart';
import 'package:hygf/util/HDSysUtils.dart';

import '../../../../res/HDColors.dart';
import '../../../../view/image_picker_widget.dart';
import 'logic.dart';

class BaseMsgPage extends StatelessWidget {
  final logic = Get.put(BaseMsgLogic());
  final state = Get.find<BaseMsgLogic>().state;

  @override
  Widget build(BuildContext context) {
    return GetBuilder<BaseMsgLogic>(builder: (logic) {
      return SingleChildScrollView(
        child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
          BrnTextInputFormItem(
            title: "姓名",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = state.itemData.customerName ?? "",
          ),
          BrnTextInputFormItem(
              title: "电话",
              isRequire: false,
              isEdit: false,
              controller: TextEditingController()
                ..text = state.itemData.phoneNumber ?? "",
              onChanged: (newValue) {}),
          BrnTextInputFormItem(
              title: "身份证号",
              isRequire: false,
              isEdit: false,
              controller: TextEditingController()
                ..text = state.itemData.idNumber ?? "",
              onChanged: (newValue) {}),
          BrnTextInputFormItem(
              title: "银行账号",
              isRequire: false,
              isEdit: false,
              controller: TextEditingController()
                ..text = state.itemData.bankCardNumber ?? "",
              onChanged: (newValue) {}),
          BrnTextInputFormItem(
              title: "开户行地址",
              isRequire: false,
              isEdit: false,
              controller: TextEditingController()
                ..text = state.itemData.bankName ?? "",
              onChanged: (newValue) {}),
          BrnTextInputFormItem(
            title: "建站地址",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = state.itemData.buildingAddress ?? "",
          ),
          BrnTextInputFormItem(
            title: "经度",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = state.itemData.longitude ?? "",
          ),
          BrnTextInputFormItem(
            title: "纬度",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = state.itemData.latitude ?? "",
          ),
          BrnTextInputFormItem(
            title: "期数",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = (state.itemData.period ?? "").toString(),
          ),
          BrnTextInputFormItem(
            title: "备注",
            isRequire: false,
            isEdit: false,
            controller: TextEditingController()
              ..text = state.itemData.remarks ?? "",
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('身份证头像面',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.idController,
              readonly: true,
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('身份证国徽面',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.idBackController,
              readonly: true,
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('银行卡照片',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.bankImageController,
              readonly: true,
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('房屋产权证明照片',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.houseImageController,
              readonly: true,
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('正大门照片',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.gateImageController,
              readonly: true,
            ),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: Text('其它',
                style: TextStyle(color: HDColors.black, fontSize: 16)),
          ),
          Container(
            margin: const EdgeInsets.fromLTRB(20, 0, 20, 0),
            child: ImagePickerWidget(
              controller: state.otherImageController,
              readonly: true,
            ),
          ),
        ]),
      );
    });
  }
}
